﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:local="clr-namespace:CoreSharp.Controls" xmlns:System="clr-namespace:System;assembly=mscorlib"
	xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
	mc:Ignorable="d"
	x:Class="CoreSharp.Controls.Keyboard"
	TextOptions.TextHintingMode="Animated" VerticalAlignment="Top" Width="480">
	<UserControl.Resources>
		<Storyboard x:Name="DelTilt">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="LayoutRoot">
				<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="20">
					<EasingDoubleKeyFrame.EasingFunction>
						<CircleEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
				<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Name="SpaceTilt">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="LayoutRoot">
				<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="-20">
					<EasingDoubleKeyFrame.EasingFunction>
						<CircleEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
				<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Name="PressBump">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="LayoutRoot">
				<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0.97"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="LayoutRoot">
				<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0.97"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
	</UserControl.Resources>

	<Grid Height="365" VerticalAlignment="Top" Background="{StaticResource PhoneChromeBrush}">
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="KeyboardStates">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="0:0:0.25"/>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="NormalKeys"/>
				<VisualState x:Name="ShiftKeys">
					<Storyboard>
						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ShiftLayout" d:IsOptimized="True"/>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="ShiftLayout">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<System:Boolean>True</System:Boolean>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="NormalLayout">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<System:Boolean>False</System:Boolean>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="NormalLayout" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="NormalLayout" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="NormalLayout" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="ShiftLayout" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="ShiftLayout" d:IsOptimized="True"/>
					</Storyboard>
				</VisualState>
				<VisualState x:Name="AltKeys">
					<Storyboard>
						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="AltLayout" d:IsOptimized="True"/>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="AltLayout">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<System:Boolean>True</System:Boolean>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="NormalLayout">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<System:Boolean>False</System:Boolean>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="NormalLayout" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="0.8" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="NormalLayout" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="0.8" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="NormalLayout" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="AltLayout" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="AltLayout" d:IsOptimized="True"/>
						<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ShiftLayout" d:IsOptimized="True"/>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
			<VisualStateGroup x:Name="LoadingStates">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="0:0:1"/>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="Load">
					<Storyboard>
						<DoubleAnimation Duration="0" To="0.2" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="LayoutRoot" d:IsOptimized="True"/>
					</Storyboard>
				</VisualState>
				<VisualState x:Name="NotLoad"/>
			</VisualStateGroup>
			<VisualStateGroup x:Name="ShowStates">
				<VisualState x:Name="ShowKeyboard"/>
				<VisualState x:Name="HideKeyboard"/>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>

		<Grid x:Name="LayoutRoot" d:LayoutOverrides="Height" RenderTransformOrigin="0.5,0.5">
			<Grid.RenderTransform>
				<CompositeTransform/>
			</Grid.RenderTransform>
			<Grid.Projection>
				<PlaneProjection/>
			</Grid.Projection>
			<toolkit:GestureService.GestureListener>
				<toolkit:GestureListener x:Name="GestureListener" Flick="GestureListener_Flick" />
			</toolkit:GestureService.GestureListener>
			<local:KeyboardLayoutViewer x:Name="NormalLayout" Margin="0,0,3,0" VerticalAlignment="Top" d:LayoutOverrides="Width" RenderTransformOrigin="0.5,0.5" >
				<local:KeyboardLayoutViewer.RenderTransform>
					<CompositeTransform/>
				</local:KeyboardLayoutViewer.RenderTransform>
			</local:KeyboardLayoutViewer>
			<local:KeyboardLayoutViewer x:Name="ShiftLayout" Margin="0,0,3,0" VerticalAlignment="Top" d:LayoutOverrides="Width" IsHitTestVisible="False" RenderTransformOrigin="0.5,0.5" Opacity="0.1" >
				<local:KeyboardLayoutViewer.RenderTransform>
					<CompositeTransform ScaleX="0.7" ScaleY="0.7"/>
				</local:KeyboardLayoutViewer.RenderTransform>
			</local:KeyboardLayoutViewer>
			<local:KeyboardLayoutViewer x:Name="AltLayout" Margin="0,0,3,0" VerticalAlignment="Top" IsHitTestVisible="False" d:LayoutOverrides="Width" RenderTransformOrigin="0.5,0.5" Opacity="0" >
				<local:KeyboardLayoutViewer.RenderTransform>
					<CompositeTransform ScaleX="1.5" ScaleY="1.5"/>
				</local:KeyboardLayoutViewer.RenderTransform>
			</local:KeyboardLayoutViewer>
		
		</Grid>
	</Grid>
</UserControl>